import React, { useEffect, useState } from "react";

export default function FunctionComponent(props) {
    const [date, setDate] = useState(new Date());
    useEffect(() => {
        // console.log("usEffect");
        const timer = setInterval(() => {
            setDate(new Date());
        },1000);
        return () => clearInterval(timer);
    },[]);

    return (
        <div>
            <h3> FunctionComponent </h3>
            <p>{date.toLocaleString()}</p>
        </div>
    );
}
